package com.devunion.salon.persistence;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;

/**
 * @author Viktar Liaskovich
 */
@Entity
@Table(name = "cheque")
public class Cheque extends BasePersistentObject {
    @Column(name = "number", nullable = true)
    private String number;

    @Column(name = "creationDate", nullable = true)
    private Date creationDate;

    @ManyToOne()
    private Customer customer;

    @ManyToOne()
    private Location location;

    @ManyToOne(cascade = {CascadeType.ALL})
    private Payment payment;

    @ManyToOne(cascade = {CascadeType.ALL})
    private Payment secondPayment;

    @Column(name = "discount", nullable = true)
    private Float discount;

    @Column(name = "reminder", nullable = true)
    private Float reminder;

    @ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
    private List<Transaction> transactions;

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    public Float getDiscount() {
        return discount;
    }

    public void setDiscount(Float discount) {
        this.discount = discount;
    }

    public Float getReminder() {
        return reminder;
    }

    public void setReminder(Float reminder) {
        this.reminder = reminder;
    }

    public List<Transaction> getTransactions() {
        return transactions;
    }

    public void setTransactions(List<Transaction> transactions) {
        this.transactions = transactions;
    }

    public Payment getPayment() {
        return payment;
    }

    public void setPayment(Payment payment) {
        this.payment = payment;
    }

    public Payment getSecondPayment() {
        return secondPayment;
    }

    public void setSecondPayment(Payment secondPayment) {
        this.secondPayment = secondPayment;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }
}
